import axios from '@/assets/model/httpconfig/AxiosApi';
import qs from 'qs';
import { WebApi } from '@/assets/model/httpconfig/WebApi';
import { Method } from 'axios';

class global {
	public logout() {
		return axios({
			url: WebApi.backstagePath + '/admin', ///global/trylogin
			method: 'post'
		});
	}
	/**
	 * 获取用户会话sessionid
	 * @param token 用户令牌
	 */
	public getSessionId(token: string) {
		return axios({
			headers: {
				Accept: 'application/json',
				Authorization: 'bearer ' + token
			},
			url: WebApi.backstagePath + '/login/getsessionid',
			method: 'post'
		});
	}
	public keycloak(parameter: any) {
		return axios({
			headers: {
				Accept: 'application/json',
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			url: 'http://localhost:8080/auth/realms/tian/protocol/openid-connect/token', ///global/trylogin
			method: 'post',
			data: qs.stringify(parameter)
		});
	}
}
export default global;
